﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ViMap.Controllers
{
    public class PlaceController : Controller
    {
        //
        // GET: /Place/

        public ActionResult Index()
        {
            return View();
        }

        [AcceptVerbs(HttpVerbs.Get)]
        public ActionResult getPlaces()
        {
            List<BusinessLogic.BizPlace> places = BusinessLogic.BizPlace.getSimplyPlaces();
            return Json(places, JsonRequestBehavior.AllowGet);
        }

        [AcceptVerbs(HttpVerbs.Get)]
        public ActionResult getPlace(int id)
        {
            BusinessLogic.BizPlace place = BusinessLogic.BizPlace.getPlacebyId(id);
            return Json(place, JsonRequestBehavior.AllowGet);
        }


        [AcceptVerbs(HttpVerbs.Get)]
        public ActionResult getAll()
        {
            List<BusinessLogic.BizPlace> places = BusinessLogic.BizPlace.getAll();
            return Json(places, JsonRequestBehavior.AllowGet);
        }

        [AcceptVerbs(HttpVerbs.Get)]
        public ActionResult getPlacebyAddress(string address, int cityId)
        {
            List<BusinessLogic.BizPlace> places = BusinessLogic.BizPlace.searchPlace(address, cityId);
            return Json(places, JsonRequestBehavior.AllowGet);
        }

    }
}
